﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
       
        private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Form2 form2 = new Form2();
            form2.Show();
           // form2.ShowDialog();
        }
        private readonly Dictionary<string, string>_user = new Dictionary<string, string>();
       // private string Key;

        private void button1_Click(object sender, EventArgs e)
        {
           // var username = "2";
           // var pwor1d = "123";
            var name = this.textBox2.Text;
            var pwd = this.textBox1.Text;
            var a = _user.Where(x => x. Key == name).FirstOrDefault();
            if(a.Key==name && a.Value == pwd) {
                MessageBox.Show("登录成功");
            }
            else
            {
                MessageBox.Show("登录失败");
            }

              
           
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            _user.Add("2","123");
        }
    }
    }

